/**
 * 
 */
package com.cs.common.listener;

import java.util.Calendar;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;


public class InitSessionListener implements HttpSessionListener  {
	/** Fecha de inicio de la session */
	private static final String INIT_SESSION_DATE = "todayDate";//$NON-NLS-1$
	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionCreated(HttpSessionEvent httpSessionEvent) {
		Calendar calendar = null;
		HttpSession httpSession = null; 
		
		try{
			calendar = Calendar.getInstance();
			httpSession = httpSessionEvent.getSession();
			httpSession.setAttribute(INIT_SESSION_DATE, calendar.getTime());
		}finally{
			calendar = null;
			httpSession = null;
		}
	}
	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
	 */
	public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
		
	}
}